/**
 * 
 */
package com.fang.dto;

import java.util.Date;

import javax.validation.constraints.Past;

import org.hibernate.validator.constraints.NotBlank;

import com.fang.validator.MyConstraint;
import com.fasterxml.jackson.annotation.JsonView;

/**
 * @author zhailiang
 *
 */
public class User {

	/**
	 * 1,使借口来申明多个视图 2，在值对象的get方法上指定视图 3，在controller上指定视图
	 */
	public interface UserSimpleView {
	};

	// 详情视图，自视图中的视图也会一起显示出来
	public interface UserDetailView extends UserSimpleView {
	};

	@MyConstraint(message = "传入了")
	private String id;

	@NotBlank(message = "姓名不能为空")
	private String username;

	@MyConstraint(message = "这是一个测试注解")
	private String password;

	/*
	 * 过去的日期
	 */

	@Past
	private Date birthday;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@JsonView(UserDetailView.class)
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@JsonView(UserSimpleView.class)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@JsonView(UserSimpleView.class)
	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

}
